home *** CD-ROM | disk | FTP | other *** search
/ Network Support Library / RoseWare - Network Support Library.iso / apidev / ndr3.exe / VERLITE.C < prev    next >
C/C++ Source or Header  |  1993-11-04  |  2KB  |  81 lines

  1. /*
  2.    VERLITE.C  shows how to obtain the version numbers
  3.               from NetWare Lite.
  4.  
  5.    Author:  Tim Farley
  6.    Copyright 1993, Tim Farley, All Rights Reserved
  7. */
  8.  
  9. #include <stdlib.h>  /* for NULL */
  10. #include <dos.h>     /* for _dos_getvect() or getvect() */
  11.  
  12. #ifdef __TURBOC__
  13.    #define ASM asm
  14.    #define GETVECT getvect
  15. #else
  16.    /* assume Microsoft C if not Turbo/Borland C */
  17.    #define ASM _asm
  18.    #define GETVECT _dos_getvect
  19. #endif
  20.  
  21.  
  22. /*
  23.    GetLiteVersion is a subroutine that calls the CLIENT or
  24.                   SERVER detect.
  25.  
  26.    Input:  funCode = DETECT_CLIENT to detect CLIENT.EXE
  27.                      DETECT_SERVER to detect SERVER.EXE
  28. */
  29. #define DETECT_CLIENT  0xD800
  30. #define DETECT_SERVER  0xD880
  31.  
  32. static int GetLiteVersion( int funCode )
  33. {
  34.    unsigned long int2Fvector;
  35.    int returnCode;
  36.    int liteVer;
  37.  
  38.    /*
  39.       Make sure INT 2Fh is initialized.  This is only
  40.       technically necessary to support DOS 2.x.
  41.    */
  42.    int2Fvector = (unsigned long)GETVECT( 0x2F );
  43.    if  ( 0UL == int2Fvector )    /* No INT 2Fh handler? */
  44.       return ( 0 );              /* then no IPX!  */
  45.  
  46.    ASM {
  47.       push  di             /* trashed by call */
  48.       mov   ax,funCode     /* CLIENT or SERVER detect */
  49.       int   2fh
  50.       xor   ah,ah
  51.       mov   returnCode,ax  /* AL = FF if present */
  52.       mov   liteVer,dx     /* DX = version */
  53.       pop   di             /* restore trashed reg */
  54.    }
  55.  
  56.    if  ( 0xFF != returnCode )    /* If return code failed */
  57.       return ( 0 );              /* return version 0.00 */
  58.  
  59.    return ( liteVer );
  60. }  /* GetLiteVersion() */
  61.  
  62.  
  63. /*
  64.    GetLiteClientVersion
  65. */
  66. int GetLiteClientVersion( void )
  67. {
  68.    return ( GetLiteVersion( DETECT_CLIENT ) );
  69. }  /* GetLiteClientVersion() */
  70.  
  71.  
  72. /*
  73.    GetLiteServerVersion
  74. */
  75. int GetLiteServerVersion( void )
  76. {
  77.    return ( GetLiteVersion( DETECT_SERVER ) );
  78. }  /* GetLiteServerVersion() */
  79.  
  80.  
  81. /* eof: VERLITE.C */